From b394cdbce6bd5a5e172c3e570ac6319849dd427b Mon Sep 17 00:00:00 2001 From: robertl Date: Sat, 24 Jul 2004 21:38:04 +0000 Subject: [PATCH] Add nukewpt suboption. Increase serial timeouts. --- gpsbabel/magproto.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/gpsbabel/magproto.c b/gpsbabel/magproto.c index aa3cee977..acbd815a1 100644 --- a/gpsbabel/magproto.c +++ b/gpsbabel/magproto.c @@ -39,6 +39,7 @@ static void *mkshort_handle; static char *deficon; static char *bs; static char *noack; +static char *nukewpt; static int route_out_count; static int waypoint_read_count; @@ -562,10 +563,13 @@ try_as_file: } GetCommTimeouts (comport, &timeout); - timeout.ReadIntervalTimeout = 100; - timeout.ReadTotalTimeoutMultiplier = 100; - timeout.ReadTotalTimeoutConstant = 100; - timeout.WriteTotalTimeoutMultiplier = 100; + /* We basically do single character reads and simulate line input + * mode, so these values are kind of fictional. + */ + timeout.ReadIntervalTimeout = 1000; + timeout.ReadTotalTimeoutMultiplier = 1000; + timeout.ReadTotalTimeoutConstant = 1000; + timeout.WriteTotalTimeoutMultiplier = 1000; timeout.WriteTotalTimeoutConstant = 1000; if (!SetCommTimeouts (comport, &timeout)) { xCloseHandle (comport); @@ -709,6 +713,7 @@ arglist_t mag_sargs[] = { {"noack", &noack, "Suppress use of handshaking in name of speed", ARGTYPE_BOOL}, {"deficon", &deficon, "Default icon name", ARGTYPE_STRING }, + {"nukewpt", &nukewpt, "Delete all waypoints", ARGTYPE_BOOL }, {0, 0, 0, 0} }; @@ -764,6 +769,15 @@ mag_rd_init(const char *portname) mag_writemsg("PMGNCMD,NMEAOFF"); ignore_unable = 0; } + if (nukewpt) { + /* The unit will send us an "end" message upon completion */ + mag_writemsg("PMGNCMD,DELETE,WAYPOINT"); + mag_readmsg(); + if (!found_done) { + fatal(MYNAME ": Unexpected response to waypoint delete command.\n"); + } + found_done = 0; + } QUEUE_INIT(&rte_wpt_tmp); -- 2.30.2